#ifndef __MQTT_CLIENT_H_
#define __MQTT_CLIENT_H_

struct mqtt_client {
	char host[128];							//MQTT服务器
	int port;								//MQTT端口
	char gwid[128];							//网关ID
	char username[128];						//用户名
	char password[128];						//密码
	char clientid[128];						//客户端ID
	int keepAlive;							//MQTT心跳间隔
	int qos;								//消息质量
	int (*mqtt_msg_handle_callback)(char *topicName, void *data, int len); // 服务器下发数据回调函数
	void (*mqtt_connect_handle_callback)(void);	// 服务器连接成功回调
};

//mqtt
int mqtt_client_connect_ok(void);
void mqtt_client_init(void);
int mqtt_client_publish_data(char *topic, unsigned char *msg, int msglen);

int mqtt_client_topic_subscribe(char *topic, int subscribe);

int mqtt_client_info_init(char *user_name, char *pass_wd, char *client_id, char *gwid);

void mqtt_client_reconnect(void);

char *get_gw_sn(void);

void get_gw_devSn(char *devSn);

void get_dev_info_desc(char *device_sn, char *device_key, char *tpunb_sn);

void replace_gw_devSn(char *dev_sn);

int set_terminal_gwsn(char *dev_sn);

char *get_terminal_gwsn(void);

#endif //__MQTT_CLIENT_H_

